﻿CREATE PROCEDURE [acms].[Site_Delete]
	@Id int, 
	@VersionId timestamp
AS
	UPDATE [Sites]
	SET [Deleted] = 1
	WHERE [Id] = @Id
		AND [VersionId] = @VersionId
		
	if @@RowCount <> 1 begin
		if Exists (SELECT null FROM [Sites] WHERE [Id] = @Id)
			RETURN -100
		else
			RETURN -200
	end
	else
		RETURN 0;